<template>
  <div class="cc-loading-mask">
    <div class="loading">
      <span v-for="item in 8" :key="item"></span>
    </div>
  </div>
</template>

<script>
export default {}
</script>

<style lang="scss">
.cc-loading-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0);

  .loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;

    span {
      display: inline-block;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: rgba(43, 157, 245, 0.6);
      position: absolute;
      animation: load 1.04s ease infinite;

      &:nth-child(1) {
        left: 0;
        top: 50%;
        margin-top: -4px;
        animation-delay: 0.13s;
      }

      &:nth-child(2) {
        left: 7px;
        top: 7px;
        animation-delay: 0.26s;
      }

      &:nth-child(3) {
        left: 50%;
        top: 0;
        margin-left: -4px;
        animation-delay: 0.39s;
      }

      &:nth-child(4) {
        top: 7px;
        right: 7px;
        animation-delay: 0.52s;
      }

      &:nth-child(5) {
        right: 0;
        top: 50%;
        margin-top: -4px;
        animation-delay: 0.65s;
      }

      &:nth-child(6) {
        right: 7px;
        bottom: 7px;
        animation-delay: 0.78s;
      }

      &:nth-child(7) {
        bottom: 0;
        left: 50%;
        margin-left: -4px;
        animation-delay: 0.91s;
      }

      &:nth-child(8) {
        bottom: 7px;
        left: 7px;
        animation-delay: 1.04s;
      }
    }

    @keyframes load {
      0% {
        opacity: 1;
      }
      100% {
        opacity: 0.2;
      }
    }
  }
}
</style>
